home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / wx / py / document.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  1KB  |  49 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
  5. __cvsid__ = '$Id: document.py 25782 2004-02-13 02:47:59Z PKO $'
  6. __revision__ = '$Revision: 25782 $'[11:-2]
  7. import os
  8.  
  9. class Document:
  10.     
  11.     def __init__(self, filename = None):
  12.         self.filename = filename
  13.         self.filepath = None
  14.         self.filedir = None
  15.         self.filebase = None
  16.         self.fileext = None
  17.         if self.filename:
  18.             self.filepath = os.path.realpath(self.filename)
  19.             (self.filedir, self.filename) = os.path.split(self.filepath)
  20.             (self.filebase, self.fileext) = os.path.splitext(self.filename)
  21.         
  22.  
  23.     
  24.     def read(self):
  25.         if self.filepath and os.path.exists(self.filepath):
  26.             f = file(self.filepath, 'rb')
  27.             
  28.             try:
  29.                 return f.read()
  30.             finally:
  31.                 f.close()
  32.  
  33.         else:
  34.             return ''
  35.  
  36.     
  37.     def write(self, text):
  38.         
  39.         try:
  40.             f = file(self.filepath, 'wb')
  41.             f.write(text)
  42.         finally:
  43.             if f:
  44.                 f.close()
  45.             
  46.  
  47.  
  48.  
  49.